<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!-- 
items=数据总条数
index=分页标明展现格式；"center", "forward" or "half-full".
maxPageItems=每页最大展现行数； 
maxIndexPages=每页最大可选页数；
isOffset=数据是否展现；
scope=参数作用范围；
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'showCustomer.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		table{
			border-collapse: collapse;
		}
		td{
		text-align: left;
		line-height: 20px;
		}
		
	</style>
  </head>
  
  <body>
  <table border="1">
  <caption >客户表</caption>
  	<tr>
  	<td>联系人姓名</td>
  	<td>联系人电话</td>
  	<td>邮箱</td>
  	<td>QQ</td>
  	<td>公司名称</td>
  	<td>公司电话号码</td>
  	<td>公司地址</td>
  	<td>状态</td>
  	<td>描述</td>
  	<td>操作</td>
  	</tr>
  	<s:iterator value="list" var="cus">
  	<tr>
  	<td><s:property value="#cus.linkMan" /></td>
  	<td><s:property value="#cus.link_tel" /></td>
  	<td><s:property value="#cus.email" /></td>
  	<td><s:property value="#cus.link_QQ" /></td>
  	<td><s:property value="#cus.company"/></td>
  	<td><s:property value="#cus.com_tel" /></td>
  	<td><s:property value="#cus.com_addr" /></td>
  	<td>
  	<s:set name="state" value="#cus.state"></s:set>
  	<s:if test="#state==0">
  	<s:text name="未联系"></s:text>
  	</s:if>
  	<s:elseif test="#state==1">
  		<s:text name="正在联系"></s:text>
  	</s:elseif>
  	<s:else>
  		<s:text name="已联系"></s:text>
  	</s:else>
  	</td>
  	<td><s:property value="#cus.description" /></td>
  	<td>
  	<s:a action="Customer_updateUI"><s:param name="id" value="#cus.id"></s:param>修改</s:a>
  	<s:a action="Customer_delete" onclick="return confirm('是否删除');"><s:param name="id"value="#cus.id"></s:param>删除</s:a>
  	</td>
  	</tr>
    </s:iterator>
    <tr>
    <td colspan="10" align="center">
    <pg:pager scope="request" maxIndexPages="5" index="center" url="Customer.action" items="${cus.total}" export="currentPageNumber=pageNumber">   
        <pg:first>   
            <a href="${pageUrl}">首页</a>   
        </pg:first>   
        <pg:prev>   
            <a href="${pageUrl }">上一页</a>   
        </pg:prev>   
        <pg:pages>   
            <c:choose>   
                <c:when test="${currentPageNumber eq pageNumber}">   
                    <font color="red">${pageNumber }</font>   
                </c:when>   
                <c:otherwise>   
                    <a href="${pageUrl }">${pageNumber }</a>   
                </c:otherwise>   
            </c:choose>   
        </pg:pages>   
        <pg:next>   
            <a href="${pageUrl }">下一页</a>   
        </pg:next>   
        <pg:last>   
            <a href="${pageUrl }">尾页</a>   
        </pg:last>   
    </pg:pager>
    </td>
    </tr>
    <tr>
    <td colspan="10" >
    <s:a action="Customer_addUI">添加</s:a>
    </td>
    </tr>
  </table>
  </body>
</html>
